<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	
	<%
		String msg = (String)request.getAttribute("msg");
		if(msg!= null){
			out.print(msg);
		}
	%>
	
	<form action="/DsqJava/session/doLogin" method="post">
	用户名:<input type="text" name="userName"/> <br>
	密码:<input type="password" name="pwd"/> <br>
	用户名:<input type="text" name="code"/> <br>
	
	<img alt="" src="/DsqJava/session/codeServlet" onclick="changeCode()"/>
	<a href="javascript:changeCode()">看不清换一张</a>
	<input type="submit" value="登录"/> <br>
	</form>
	
	
	
	<script type="text/javascript">
	function changeCode(){
		//得到图片元素
		var img = document.getElementsByTagName("img")[0];
		//img.setAttribute("src","/day09_00_HttpServletResponse/servlet/demo4");//XML Dom 语法
		img.src = "/DsqJava/session/codeServlet?time="+new Date().getTime();
	}
</script>
	
</body>
</html>